package com.gitee.wsl.compose.ui.icon

import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.layout.Box
import androidx.compose.material.icons.Icons
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.gitee.wsl.compose.icon.filled.ArrowDownDoc
import com.gitee.wsl.compose.icon.filled.ArrowUpDoc
import com.gitee.wsl.compose.ui.base.Icon


/**
 * @author Stanislav Aleshin on 25.02.2023.
 */
@Composable
fun Icon.Expanded(
    modifier: Modifier = Modifier,
    isExpanded: Boolean,
    color: Color = MaterialTheme.colorScheme.onSurface,
    description: String? = null,
) {
    val icon = when (isExpanded) {
        true -> Icons.Default.ArrowUpDoc
        false -> Icons.Default.ArrowDownDoc
    }
    Box(modifier = modifier.animateContentSize()) {
        Icon(
            imageVector = icon,
            contentDescription = description,
            tint = color,
        )
    }
}